home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HamCall (April 1991)
/
HAMCALL CD-ROM (Buckmaster)(April 1991).BIN
/
util
/
benchmrk
/
bench12.bas
< prev
next >
Wrap
BASIC Source File
|
1990-10-14
|
5KB
|
188 lines
100 'BENCH12.BAS VERSION 1.0.0
200 ' CREATED BY BILL MACHRONE 06-83
300 ' MODIFIED BY MIKE O'CONE
400 ' Modified 2/15/86 by Charles Petzold:
410 ' Line 3800: SYSTEM on termination.
420 ' Line 17610-20: CLOSE and KILL file after File Update Test.
430 '
500 ' PC MAGAZINE
600 ' A ZIFF-DAVIS PUBLICATION
700 '
800 KEY OFF :CLS :CLEAR
900 COLOR 0,7
1000 LOCATE 3,25 :PRINT " BASIC BENCHMARKS "
1100 LOCATE 4,25 :PRINT "-----------------------------"
1200 LOCATE 5,25 :PRINT "--PPPPPPPP-----CCCCCCCCCCCC--"
1300 LOCATE 6,25 :PRINT "--PPPPPPPPP----CCCCCCCCCCCC--"
1400 LOCATE 7,25 :PRINT "--PPPP---PPP---CCCC----CCCC--"
1500 LOCATE 8,25 :PRINT "--PPPP---PPP---CCCC----CCCC--"
1600 LOCATE 9,25 :PRINT "--PPPP---PPP---CCCC----CCCC--"
1700 LOCATE 10,25 :PRINT "--PPPPPPPPP----CCCC----------"
1800 LOCATE 11,25 :PRINT "--PPPPPPPP-----CCCC----CCCC--"
1900 LOCATE 12,25 :PRINT "--PPPP---------CCCC----CCCC--"
2000 LOCATE 13,25 :PRINT "--PPPP---------CCCC----CCCC--"
2100 LOCATE 14,25 :PRINT "--PPPP---------CCCCCCCCCCCC--"
2200 LOCATE 15,25 :PRINT "--PPPP---------CCCCCCCCCCCC--"
2300 LOCATE 16,25 :PRINT "-----------------------------"
2400 LOCATE 17,25 :PRINT " BENCHMARK TEST #12 "
2500 COLOR 7,0
2600 '
2700 '
2800 '
2900 CL$=STRING$(79,32)
3000 LOCATE 6,60 :PRINT "TEST #" TAB(70) "DURATION"
3100 LOCATE 21,1 :PRINT CL$
3200 LOCATE 19,10 :PRINT "1. INTEGER ADDITION #1" :LOCATE 19,50 :PRINT "5. DATA LOOKUP"
3300 LOCATE 20,10 :PRINT "2. INTEGER ADDITION #2" :LOCATE 20,50 :PRINT "6. EMPTY LOOP"
3400 LOCATE 21,10 :PRINT "3. FLOATING POINT" :LOCATE 21,50 :PRINT "7. FILE UPDATE"
3500 LOCATE 22,10 :PRINT "4. STRING CONCATENATION" :LOCATE 22,50 :PRINT "8. ALL"
3600 LOCATE 1,55 :PRINT " "
3700 LOCATE 1,20 :LINE INPUT;"ENTER TEST SELECTION OR ENTER 'Q' TO QUIT ";SEL$
3800 IF SEL$="Q" OR SEL$="q" THEN SYSTEM
3900 SEL%=VAL(SEL$)
4000 IF SEL%<1 OR SEL%>8 THEN GOTO 3600
4100 LOCATE 1,1 :PRINT CL$
4200 LOCATE 1,25 :COLOR 16,7 :PRINT " PLEASE WAIT " :COLOR 7,0
4300 IF SEL%=8 THEN GOTO 5300
4400 IF SEL%=1 THEN GOSUB 7100
4500 IF SEL%=2 THEN GOSUB 8200
4600 IF SEL%=3 THEN GOSUB 9300
4700 IF SEL%=4 THEN GOSUB 10700
4800 IF SEL%=5 THEN GOSUB 12100
4900 IF SEL%=6 THEN GOSUB 14200
5000 IF SEL%=7 THEN GOSUB 15300
5100 LOCATE 8,60 :PRINT RE1$ TAB(70) RE2$
5200 GOTO 6800
5300 'SEL%=8
5400 GOSUB 7100
5500 LOCATE 8,60 :PRINT RE1$ TAB(70) RE2$
5600 GOSUB 8200
5700 LOCATE 9,60 :PRINT RE1$ TAB(70) RE2$
5800 GOSUB 9300
5900 LOCATE 10,60 :PRINT RE1$ TAB(70) RE2$
6000 GOSUB 10700
6100 LOCATE 11,60 :PRINT RE1$ TAB(70) RE2$
6200 GOSUB 12100
6300 LOCATE 12,60 :PRINT RE1$ TAB(70) RE2$
6400 GOSUB 14200
6500 LOCATE 13,60 :PRINT RE1$ TAB(70) RE2$
6600 GOSUB 15300
6700 LOCATE 14,60 :PRINT RE1$ TAB(70) RE2$
6800 LOCATE 1,25 :COLOR 0,7 :PRINT " TESTING COMPLETE " :COLOR 7,0
6900 LOCATE 2,28 :PRINT "HIT ANY KEY TO CONTINUE ";
7000 Z$=INKEY$ :IF Z$="" THEN GOTO 7000 ELSE GOTO 800
7100 '
7200 'INTEGER ADDITION #1 SUBROUTINE (INTADD.BAS)
7300 '
7400 '
7500 TIME$ = "0"
7600 WHILE X < 10000
7700 X = X + 1
7800 WEND
7900 '
8000 RE1$="1" :RE2$=TIME$
8100 RETURN
8200 '
8300 'INTEGER ADDITION #2 SUBROUTINE (INTADD2.BAS)
8400 '
8500 '
8600 TIME$ = "0"
8700 FOR X = 1 TO 10000
8800 V = V + 1
8900 NEXT X
9000 '
9100 RE1$="2" :RE2$=TIME$
9200 RETURN
9300 '
9400 'FLOATING POINT SUBROUTINE (FP.BAS)
9500 '
9600 '
9700 DEFINT X
9800 TIME$ = "0"
9900 FOR X = 1 TO 10000
10000 A=0:B=1234.56:C=78.9
10100 A=B*C
10200 A=B/C
10300 NEXT X
10400 '
10500 RE1$="3" :RE2$=TIME$
10600 RETURN
10700 '
10800 'STRING CONCATENATION SUBROUTINE (CONCAT.BAS)
10900 '
11000 '
11100 DEFINT X
11200 TIME$ = "0"
11300 FOR X = 1 TO 10000
11400 A$ = "This is a string"
11500 B$ = "This is a longer string with lots of words in it."
11600 C$ = A$+B$
11700 NEXT X
11800 '
11900 RE1$="4" :RE2$=TIME$
12000 RETURN
12100 '
12200 'DATA LOOKUP SUBROUTINE (LOOKUP.BAS)
12300 '
12400 '
12500 DEFINT B-Z
12600 DIM A(25)
12700 TIME$ = "0"
12800 FOR X = 1 TO 1000
12900 RESTORE 13500
13000 FOR LOOP = 1 TO 25
13100 READ A(LOOP)
13200 NEXT LOOP
13300 NEXT X
13400 '
13500 DATA 1,2,3,4,5
13600 DATA 6,7,8,9,10
13700 DATA 11,12,13,14,15
13800 DATA 16,17,18,19,20
13900 DATA 21,22,23,24,25
14000 RE1$="5" :RE2$=TIME$
14100 RETURN
14200 '
14300 'EMPTY LOOP SUBROUTINE (EMPTY)
14400 '
14500 '
14600 'empty.bas
14700 TIME$ = "0"
14800 FOR X = 1 TO 10000
14900 NEXT X
15000 '
15100 RE1$="6" :RE2$=TIME$
15200 RETURN
15300 '
15400 'FILE UPDATE SUBROUTINE (UPDATE.BAS)
15500 '
15600 '
15700 TIME$ = "0"
15800 DEFINT X
15900 OPEN "R",1,"BENCH12.DAT", 132
16000 FIELD #1, 132 AS RECORD$
16100 NUMRECS=1000
16200 FOR X = 1 TO NUMRECS
16300 PUT #1,X
16400 NEXT X
16500 'read records back.
16600 FOR X = 1 TO NUMRECS
16700 GET #1,X
16800 NEXT X
16900 'modify and rewrite records.
17000 FOR X = 1 TO NUMRECS
17100 GOSUB 17900
17200 LSET RECORD$ = "Modified"
17300 GOSUB 18100
17400 NEXT X
17500 '
17600 RE1$="7" :RE2$=TIME$
17610 CLOSE #1
17620 KILL "BENCH12.DAT"
17700 RETURN
17800 '
17900 GET #1,X
18000 RETURN
18100 PUT #1,X
18200 RETURN